package cn.com.mjsoft.framework.behavior;

/**
 * 指令类,指示某种行为的执行
 * 
 * @author mjsoft
 */
public final class Denotation
{
    /**
     * 行为类型
     */
    private String denotation;

    /**
     * 执行一次行为所需要的参数
     */
    private Object[] denotationParams;

    public Denotation( String denotation )
    {
        this.denotation = denotation;
    }

    public Denotation( String denotation, Object[] params )
    {
        this.denotation = denotation;
        this.denotationParams = params;
    }

    public String getDenotation()
    {
        return denotation;
    }

    public void setDenotation( String denotation )
    {
        this.denotation = denotation;
    }

    public Object[] getParams()
    {
        return denotationParams;
    }

    public void setParams( Object[] params )
    {
        this.denotationParams = params;
    }

    public boolean checkDenotation( String denotation )
    {
        if( null == denotation )
        {
            return false;
        }

        if( denotation.trim().equals( "" ) )
        {
            return false;
        }

        return denotation.trim().equals( this.denotation );
    }

    public boolean equals( Object obj )
    {
        return this.denotation.equals( ( ( Denotation ) obj ).denotation );
    }

    public int hashCode()
    {
        return this.denotation.hashCode();
    }
}
